from djangoappengine.settings_base import *

import os

SECRET_KEY = '=r-$b*8hglm+858&9t043hlm6-&6-3d3vfc4((7yd0dbrakhvi'
AUTH_PROFILE_MODULE = 'labapp.UserProfile'

DEFAULT_CHARSET = 'utf-8'


INSTALLED_APPS = (
    'djangotoolbox',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'labapp',
    'dbindexer',
    'autoload',
    'djangoappengine'
)

MIDDLEWARE_CLASSES = (
    'autoload.middleware.AutoloadMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
)

TEMPLATE_CONTEXT_PROCESSORS = (
    'django.contrib.auth.context_processors.auth',
    'django.core.context_processors.request',
)

LOGIN_REDIRECT_URL = '/labapp/'

ADMIN_MEDIA_PREFIX = '/media/admin/'
MEDIA_ROOT = os.path.join(os.path.dirname(__file__), 'media')
TEMPLATE_DIRS = (os.path.join(os.path.dirname(__file__), 'templates'),)

ROOT_URLCONF = 'urls'


#==================== DATABASE ====================#
try:
   import dbindexer
   DATABASES = {
       'default': {
           'ENGINE': 'dbindexer',
           'TARGET': 'gae',
           'HIGH_REPLICATION': True
       },
       'gae': {
           'ENGINE': 'djangoappengine.db'
       }
   }

except ImportError:
   pass

DBINDEXER_BACKENDS = (
   'dbindexer.backends.BaseResolver',
   'dbindexer.backends.FKNullFix',
   'dbindexer.backends.ConstantFieldJOINResolver',
)







